package com.xn.app.muying.BroadcastReceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.xn.app.muying.fragment.HomeFragment;
import com.xn.app.muying.fragment.MineFragment;

/**
 * Created by Administrator on 2016/10/26.
 */
public class MyBroadcastReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {

        if(MineFragment.zhuangtai==null ){

        }else{

            String pageIntent=intent.getStringExtra("PAGE_INTENT");
            if(intent.getAction().equals("PREGNANCY_INFO")){//怀孕期
                if(pageIntent.equals("HomeFragment")){
                    HomeFragment.yunqishezhi_tv.setText("怀孕期");
                }else{
                    String hosptialname=intent.getStringExtra("HOSPTIALNAME");
                    HomeFragment.yunqishezhi_tv.setText("怀孕期");
                    MineFragment.zhuangtai.setText("怀孕期");
//                    MineFragment.yiyuan.setText(hosptialname);
                }

            }else if(intent.getAction().equals("PREPARE_PREGNANCY_INFO")){
                if(pageIntent.equals("HomeFragment")){
                    HomeFragment.yunqishezhi_tv.setText("备孕期");
                }else{
                    HomeFragment.yunqishezhi_tv.setText("备孕期");
                    MineFragment.zhuangtai.setText("备孕期");
                }
            }


//            if(intent.getAction().equals("mode")){//怀孕期
//                MineFragment.zhuangtai.setText("怀孕期");
//            }else if(intent.getAction().equals("hosptial")){
//                MineFragment.yiyuan.setText(intent.getStringExtra("name"));
//            }else if(intent.getAction().equals("state")){//备孕期
//                MineFragment.zhuangtai.setText(intent.getStringExtra("info"));
//            }else if(intent.getAction().equals("home")){
//                MineFragment.zhuangtai.setText("怀孕期");
//            }
        }


    }

}
